Prefer clang as the compiler on OSX >= 10.7
authorDaniel Sabo <DanielSabo@gmail.com>
Thu, 10 Oct 2013 12:39:50 +0000 (05:39 -0700)
committerDaniel Sabo <DanielSabo@gmail.com>
Thu, 10 Oct 2013 12:40:51 +0000 (05:40 -0700)
configure.ac

index d5e5d68fb0a0feded4d5dcd892c336a550c41eae..8d3826a4b8d27a995428daa1c128dc4ab7f37e12 100644 (file)
@@ -112,6 +112,7 @@ AC_SUBST(BABL_CURRENT_MINUS_AGE)
 
 dnl ==========================================================================
 
+AC_CANONICAL_SYSTEM
 AM_INIT_AUTOMAKE([1.11 foreign no-define dist-bzip2 no-dist-gzip -Wno-portability])
 
 # Enable silent build rules by default, requires at least
@@ -119,7 +120,28 @@ AM_INIT_AUTOMAKE([1.11 foreign no-define dist-bzip2 no-dist-gzip -Wno-portabilit
 # configure or passing V=1 to make
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
-BABL_VARIADIC_MACROS
+# Prefer clang on OSX, because GCC isn't updated
+
+case "$build_os" in
+  darwin10.* | darwin9.* | darwin8.*)
+    ;;
+  darwin*)
+    prefered_cc="clang"
+    prefered_cxx="clang++"
+    ;;
+  *)
+    ;;
+esac
+
+if test -z "$CC" && test -n "$prefered_cc"; then
+  AC_MSG_NOTICE([setting CC to $prefered_cc for $build_os])
+  CC=$prefered_cc
+fi
+
+if test -z "$CXX" && test -n "$prefered_cc"; then
+  AC_MSG_NOTICE([setting CXX to $prefered_cxx for $build_os])
+  CXX=$prefered_cxx
+fi
 
 # Check for programs
 AC_PROG_CC
@@ -129,6 +151,8 @@ AC_PROG_CC_C99
 LT_PREREQ([2.2])
 LT_INIT([disable-static win32-dll])
 
+BABL_VARIADIC_MACROS
+
 dnl Initialize maintainer mode
 AM_MAINTAINER_MODE([enable])